package com.sample.utils;

import java.util.Collection;
import java.util.Iterator;

/**
 * @author Ilya N. Ternovikh
 * 
 */
public class CollectionUtils {
	public static <T> T firstOrDefault(Collection<T> source) {
		if (source == null)
			return null;

		Iterator<T> iterator = source.iterator();
		if (iterator.hasNext()) {
			return iterator.next();
		}

		return null;
	}
}
